/**********************************************************************************
// Ship Header File
// 
// Creation:	06 Mai 2011
// Updated:		02 Jun 2011
// Compiler:	Visual Studio 2010
//
// Notes:		Defines a space ship for the game Space Race 
//
**********************************************************************************/

#ifndef _SPACESHIP_H_
#define _SPACESHIP_H_

/**********************************************************************************/

#include "Sprite.h"
#include "Vector.h"
#include "Types.h"

/**********************************************************************************/

enum ShipAnims { INERTIA, FORWARD, BACKWARD};

/**********************************************************************************/

struct SaveShip
{
	Vector2 speed;
	Vector2 direction;
	Geometry * boundingbox;
	float rotation;
	float x;
	float y;

	SaveShip()
	{
		speed.SetVector(0,0);
		direction.SetVector(0,0);
		boundingbox = nullptr;
		rotation = 0;
		x = 0;
		y = 0;
	}
};

/**********************************************************************************/

class Ship : public Sprite
{
public:
	Vector2  speed;							// space ship current speed 
	Vector2  direction;						// space ship nose direction

private:
	Animation * inertialShipAnim;			// inertial ship ship animation
	Animation * forwardThrustAnim;			// forward thrust animation
	Animation * backwadThrustAnim;			// backward thrust animation
	Sprite    * shipExplosion;				// space ship explosion sprite sheet
	Animation * shipExplosionAnim;			// space ship explosion animation

public:
	Ship();									// default constructor
	~Ship();								// destructor

	void Rotate(float ang);					// rotate the space ship
	void Accelerate();						// accelerate ship forward
	void Brake();							// accelerate ship backward
	void Reset();							// reset default direction and speed
	void Animate(int anim);					// change ship animation sequence
	void Explode();							// play space ship explosion animation
	bool isExploding();						// returns true if explosion animation is active
	void DrawExplosion();					// update and draw explosion animation
};

/**********************************************************************************/

#endif